import os

import requests
import base64


def getByte(path):
    with open(path, 'rb') as f:
        img_byte = base64.b64encode(f.read())
    img_str = img_byte.decode('ascii')
    return img_str


for filename in os.listdir('C://Users//Dell//Desktop//image'):
    img_str = getByte('C:\\Users\\Dell\\Desktop\\image\\'+filename)
    url = 'http://192.168.0.210:5000/DistingSubSys/Service'
    paramdata = {'image_name': filename}
    r = requests.post(url, params=paramdata, data=img_str)
